package cn.juforg.mail;

import java.util.Date;

import cn.juforg.constant.Constants;

public class MailSender {
	private String from;
	private String to ;
	private String host ;
	private String password;
	private String filePath;
	
	public MailSender() {
		this.from = Constants.FROM;
		this.to = Constants.TO;
		this.host = Constants.HOST;
		this.password = Constants.PASSWORD;
		this.filePath = (new StringBuilder(String.valueOf(Constants.IMG_PATH))).append(Constants.IMG_NAME).toString();;
	}
	
	public boolean send(){
		MailConstructor mc = new MailConstructor(this.host);
		mc.setBody((new StringBuilder(String.valueOf(Math.random() + Math.random() + Math.random() + Math.random()))).append(new Date()).toString());
		mc.setSubject((new StringBuilder(" ")).append(Math.random()).append(new Date()).toString());
		mc.setFrom(from);
		mc.setTo(to);
		mc.addFileAffix(filePath);
		mc.setNamePass(from, password);
		return mc.sendOut();
	}
	
}
